
/*
 * Copyright 2002-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2016原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans.factory;

/**
 * Interface to be implemented by beans that want to be aware of their
 * bean name in a bean factory. Note that it is not usually recommended
 * that an object depends on its bean name, as this represents a potentially
 * brittle dependence on external configuration, as well as a possibly
 * unnecessary dependence on a Spring API.
 *
 * <p>For a list of all bean lifecycle methods, see the
 * {@link BeanFactory BeanFactory javadocs}.
 *
 * @author Juergen Hoeller
 * @author Chris Beams
 * @since 01.11.2003
 * @see BeanClassLoaderAware
 * @see BeanFactoryAware
 * @see InitializingBean
 */
/**
 *要由希望了解其
 *bean工厂中的bean名称。注意，通常不建议使用
 *一个对象依赖于它的bean名称，因为这表示一个潜在的
 *对外部配置的脆弱依赖，以及
 *对Spring API的不必要依赖。
 *
 *＜p＞有关所有bean生命周期方法的列表，请参阅
 *｛@link BeanFactory BeanFactory javadocs｝。
 *
 *@作者Juergen Hoeller
 *@作者Chris Beams
 *@自2003年11月1日
 *@参见BeanClassLoaderAware
 *@参见BeanFactory软件
 *@参见InitializingBean
 */
public interface BeanNameAware extends Aware {

	/**
	 * Set the name of the bean in the bean factory that created this bean.
	 * <p>Invoked after population of normal bean properties but before an
	 * init callback such as {@link InitializingBean#afterPropertiesSet()}
	 * or a custom init-method.
	 * @param name the name of the bean in the factory.
	 * Note that this name is the actual bean name used in the factory, which may
	 * differ from the originally specified name: in particular for inner bean
	 * names, the actual bean name might have been made unique through appending
	 * "#..." suffixes. Use the {@link BeanFactoryUtils#originalBeanName(String)}
	 * method to extract the original bean name (without suffix), if desired.
	 */
	/**
	 *在创建此bean的bean工厂中设置bean的名称。
	 *<p>在填充正常bean财产之后但在
	 *init回调，例如｛@link InitializingBean#afterPropertiesSet（）｝
	 *或自定义init方法。
	 *@param name工厂中bean的名称。
	 *注意，该名称是工厂中使用的实际bean名称
	 *与最初指定的名称不同：特别是对于内部bean
	 *name，实际的bean名称可能通过附加
	 *“#…”后缀。使用｛@link BeanFactoryUtils#originalBeanName（字符串）｝
	 *方法提取原始bean名称（不带后缀）。
	 */
	void setBeanName(String name);

}
